Wake device before launching Android apps - #12322
Conversation
Wake sleeping devices and dismiss non-secure keyguards before starting deployed applications, keeping preparation and launch in one adb shell invocation. Add --no-wake-device as an escape hatch through the existing _AndroidRunExtraArgs passthrough and cover both command modes in device integration tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates Microsoft.Android.Run to proactively wake an Android device and dismiss a non-secure keyguard before launching an app activity, with an opt-out flag (--no-wake-device) and a device integration test validating both behaviors.
Changes:
- Added
--no-wake-deviceoption toMicrosoft.Android.Runto skip wake/keyguard dismissal. - Updated the activity-start adb invocation to include wake + keyguard dismissal when enabled.
- Extended device integration coverage to assert the adb command-line behavior with and without wakeup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.Android.Run/Program.cs | Adds wake/keyguard behavior to the adb shell … am start … launch path and introduces --no-wake-device. |
| tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | Adds parameterized test coverage asserting wake vs. non-wake dotnet run behavior via verbose output. |
Treat wakeup and keyguard dismissal as best effort so unsupported or secure-device behavior cannot prevent am start from running or control its exit status. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/review |
|
✅ Android PR Reviewer completed successfully! |
There was a problem hiding this comment.
✅ LGTM
No correctness or safety issues found. The wake/keyguard preparation is correctly best-effort while am start remains authoritative, the opt-out is wired through the existing run arguments, and both paths have device integration coverage.
Findings: 0 errors · 0 warnings · 1 suggestion
CI is green across all 44 checks (Azure DevOps build 1545007).
Generated by Android PR Reviewer for #12322 · gpt56 · 135.4 AIC · ⌖ 9.98 AIC · ⊞ 25.7K
Comment /review to run again
Materialize the streamed log buffer once before writing diagnostics and checking launch behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Summary
Microsoft.Android.Runstarts an activityadb shellinvocation--no-wake-device, available to MSBuild callers through$(_AndroidRunExtraArgs), as an escape hatchFixes #11064.
Testing
Xamarin.Android.slnand configured the local Android workloaddotnet new androidtemplatedotnet-local.cmd runon a sleeping, locked physical device--no-wake-deviceomits both device-preparation commands